package com.example.cxf.client2.write;

import com.example.cxf.service2.HelloWorld;
import com.example.cxf.service2.User;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class HelloWorldClient {
    /**
     * @param args
     */
    public static void main(String[] args) {

        //首先右键run as 运行com.hsy.server.webServiceApp类，然后再运行这段客户端代码
        JaxWsProxyFactoryBean jwpfb = new JaxWsProxyFactoryBean();
        jwpfb.setServiceClass(HelloWorld.class);
        jwpfb.setAddress("http://localhost:8080/helloWorld");
        HelloWorld hw = (HelloWorld) jwpfb.create();
        User user = new User();
        user.setName("马克思");
        user.setEmail("怀念马克思");
        System.out.println(hw.sayHiToUser(user)+"成功");

    }
}
